package com.daoeping.data;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Bzn_question entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "bzn_question", catalog = "daoeping")
public class Bzn_question implements java.io.Serializable {

	// Fields

	private Integer id;
	private Usr_user usr_user;
	private Bsc_category bsc_category;
	private String title;
	private String content;
	private String attachment;
	private Timestamp createDatetime;
	private Timestamp updateDatetime;
	private Integer flag;
	private Set<Bzn_questionassigned> bzn_questionassigneds = new HashSet<Bzn_questionassigned>(
			0);
	private Set<Bzn_questionfollow> bzn_questionfollows = new HashSet<Bzn_questionfollow>(
			0);
	private Set<Bzn_answer> bzn_answers = new HashSet<Bzn_answer>(0);
	private Set<Bzn_questioncomm> bzn_questioncomms = new HashSet<Bzn_questioncomm>(
			0);
	private Set<Bzn_questionfavorite> bzn_questionfavorites = new HashSet<Bzn_questionfavorite>(
			0);

	// Constructors

	/** default constructor */
	public Bzn_question() {
	}

	/** minimal constructor */
	public Bzn_question(Usr_user usr_user) {
		this.usr_user = usr_user;
	}

	/** full constructor */
	public Bzn_question(Usr_user usr_user, Bsc_category bsc_category,
			String title, String content, String attachment,
			Timestamp createDatetime, Timestamp updateDatetime, Integer flag,
			Set<Bzn_questionassigned> bzn_questionassigneds,
			Set<Bzn_questionfollow> bzn_questionfollows,
			Set<Bzn_answer> bzn_answers,
			Set<Bzn_questioncomm> bzn_questioncomms,
			Set<Bzn_questionfavorite> bzn_questionfavorites) {
		this.usr_user = usr_user;
		this.bsc_category = bsc_category;
		this.title = title;
		this.content = content;
		this.attachment = attachment;
		this.createDatetime = createDatetime;
		this.updateDatetime = updateDatetime;
		this.flag = flag;
		this.bzn_questionassigneds = bzn_questionassigneds;
		this.bzn_questionfollows = bzn_questionfollows;
		this.bzn_answers = bzn_answers;
		this.bzn_questioncomms = bzn_questioncomms;
		this.bzn_questionfavorites = bzn_questionfavorites;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY )
	@JoinColumn(name = "user_id", nullable = false)
	public Usr_user getUsr_user() {
		return this.usr_user;
	}

	public void setUsr_user(Usr_user usr_user) {
		this.usr_user = usr_user;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "category_id")
	public Bsc_category getBsc_category() {
		return this.bsc_category;
	}

	public void setBsc_category(Bsc_category bsc_category) {
		this.bsc_category = bsc_category;
	}

	@Column(name = "title", length = 250)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "content", length = 2000)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "attachment", length = 2000)
	public String getAttachment() {
		return this.attachment;
	}

	public void setAttachment(String attachment) {
		this.attachment = attachment;
	}

	@Column(name = "create_datetime", length = 19)
	public Timestamp getCreateDatetime() {
		return this.createDatetime;
	}

	public void setCreateDatetime(Timestamp createDatetime) {
		this.createDatetime = createDatetime;
	}

	@Column(name = "update_datetime", length = 19)
	public Timestamp getUpdateDatetime() {
		return this.updateDatetime;
	}

	public void setUpdateDatetime(Timestamp updateDatetime) {
		this.updateDatetime = updateDatetime;
	}

	@Column(name = "flag")
	public Integer getFlag() {
		return this.flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bzn_question")
	public Set<Bzn_questionassigned> getBzn_questionassigneds() {
		return this.bzn_questionassigneds;
	}

	public void setBzn_questionassigneds(
			Set<Bzn_questionassigned> bzn_questionassigneds) {
		this.bzn_questionassigneds = bzn_questionassigneds;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bzn_question" )
	public Set<Bzn_questionfollow> getBzn_questionfollows() {
		return this.bzn_questionfollows;
	}

	public void setBzn_questionfollows(
			Set<Bzn_questionfollow> bzn_questionfollows) {
		this.bzn_questionfollows = bzn_questionfollows;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bzn_question")
	public Set<Bzn_answer> getBzn_answers() {
		return this.bzn_answers;
	}

	public void setBzn_answers(Set<Bzn_answer> bzn_answers) {
		this.bzn_answers = bzn_answers;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bzn_question")
	public Set<Bzn_questioncomm> getBzn_questioncomms() {
		return this.bzn_questioncomms;
	}

	public void setBzn_questioncomms(Set<Bzn_questioncomm> bzn_questioncomms) {
		this.bzn_questioncomms = bzn_questioncomms;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bzn_question")
	public Set<Bzn_questionfavorite> getBzn_questionfavorites() {
		return this.bzn_questionfavorites;
	}

	public void setBzn_questionfavorites(
			Set<Bzn_questionfavorite> bzn_questionfavorites) {
		this.bzn_questionfavorites = bzn_questionfavorites;
	}

}